#include <iostream>
#include <vector>
#include "functions.h"

std::vector<point> raster(segment segm)
{
	if (segm.from.x > segm.to.x)
		std::swap(segm.from, segm.to);
	std::vector<point> points;
	point current_cell(floor(segm.from.x), floor(segm.from.y));
	point finish_cell(floor(segm.to.x), floor(segm.to.y));
	int sign = ((segm.to.y - segm.from.y) > 0) - ((segm.to.y - segm.from.y) < 0);
	points.push_back(current_cell);

	while (!(current_cell == finish_cell))
	{
		point tmp_cell = current_cell;
		tmp_cell.x++;
		if (sign > 0)
			tmp_cell.y++;
		int turn = left_turn(segm.from, segm.to, tmp_cell);

		switch(sign)
		{
		case 1:
			switch(turn)
			{
			case 1:
				current_cell.x++;
				break;

			case 0:
				current_cell.x++;
				current_cell.y++;
				break;

			case -1:
				current_cell.y++;
			}
			break;
		case 0:
			current_cell.x++;
			break;
		case -1:
			switch(turn)
			{
			case 1:
				current_cell.y--;
				break;

			case 0:
				points.push_back(tmp_cell);
				current_cell.x++;
				current_cell.y--;
				break;

			case -1:
				current_cell.x++;
				break;
			}
		}

		if (sign == 0 && (current_cell.x > finish_cell.x))
			break;
		if (sign != 0 && (current_cell.x == finish_cell.x) && ((current_cell.y - finish_cell.y) * sign > 0))
			break;
		points.push_back(current_cell);
	}
	return points;
}

void border(segment segm, std::vector<std::pair<int, int>>& old_border, int leftmost)
{
	std::vector<point> points = raster(segm);

	for (auto iter = points.begin(); iter < points.end(); iter++)
	{
		old_border[iter->x - leftmost].first = std::min(old_border[iter->x - leftmost].first, static_cast<int>(iter->y));
		old_border[iter->x - leftmost].second = std::max(old_border[iter->x - leftmost].second, static_cast<int>(iter->y));
	}
}

int main()
{
	std::ifstream in ("in.txt");
	std::ofstream out("out.txt");
	int count;
	std::cin >> count;
	std::vector<point> poligon(count);
	std::cin >> poligon[0].x >> poligon[0].y;
	int min_x = poligon[0].x, max_x = poligon[0].x;
	for (int i = 1; i < count; i++)
	{
		std::cin >> poligon[i].x >> poligon[i].y;
		if (min_x > poligon[i].x)
			min_x = poligon[i].x;
		if (max_x < poligon[i].x)
			max_x = poligon[i].x;
	}
	std::pair<int, int> tmp = std::pair<int, int> (std::numeric_limits<int>::max(), -std::numeric_limits<int>::max());
	std::vector<std::pair<int, int>> answer = std::vector<std::pair<int, int>> (max_x - min_x + 1, tmp);

	for (int i = 0; i < count; i++)
		border(segment(poligon[i], poligon[(i + 1) % count]), answer, min_x);
	int num = 0;
	for (auto iter = answer.begin(); iter < answer.end(); iter++)
		num += iter->second - iter->first + 1;

	std::cout << num << '\r';
	for (int x = min_x; x < max_x + 1; x++)
		for (int y = answer[x - min_x].first; y <= answer[x - min_x].second; y++)
			std::cout << x << ' ' << y << '\r';
	
}